home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / gs_kanji.ps < prev    next >
Text File  |  1996-01-10  |  4KB  |  160 lines

  1. %    Copyright (C) 1994, 1995 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % Scaffolding for Kanji fonts.  This is based on the Wadalab free font
  16. % from the University of Tokyo; it may not be appropriate for other
  17. % Kanji fonts.
  18.  
  19. /currentglobal where
  20.  { pop currentglobal { setglobal } true setglobal }
  21.  { { } }
  22. ifelse
  23.  
  24. % Define the encoding for the root font.
  25.  
  26. /KanjiEncoding
  27. % \x00
  28.     0    0    0    0    0    0    0    0
  29.     0    0    0    0    0    0    0    0
  30.     0    0    0    0    0    0    0    0
  31.     0    0    0    0    0    0    0    0
  32. % \x20
  33.     0    1    2    3    4    5    6    7
  34.     8    0    0    0    0    0    0    0
  35.     9    10    11    12    13    14    15    16
  36.     17    18    19    20    21    22    23    24
  37. % \x40
  38.     25    26    27    28    29    30    31    32
  39.     33    34    35    36    37    38    39    40
  40.     41    42    43    44    45    46    47    48
  41.     49    50    51    52    53    54    55    56
  42. % \x60
  43.     57    58    59    60    61    62    63    64
  44.     65    66    67    68    69    70    71    72
  45.     73    74    75    76    77    0    0    0
  46.     0    0    0    0    0    0    0    0
  47. % \x80
  48.     0    0    0    0    0    0    0    0
  49.     0    0    0    0    0    0    0    0
  50.     0    0    0    0    0    0    0    0
  51.     0    0    0    0    0    0    0    0
  52. % \xA0
  53.     0    1    2    3    4    5    6    7
  54.     8    0    0    0    0    0    0    0
  55.     9    10    11    12    13    14    15    16
  56.     17    18    19    20    21    22    23    24
  57. % \xC0
  58.     25    26    27    28    29    30    31    32
  59.     33    34    35    36    37    38    39    40
  60.     41    42    43    44    45    46    47    48
  61.     49    50    51    52    53    54    55    56
  62. % \xE0
  63.     57    58    59    60    61    62    63    64
  64.     65    66    67    68    69    70    71    72
  65.     73    74    75    76    77    0    0    0
  66.     0    0    0    0    0    0    0    0
  67. 256 packedarray def
  68.  
  69. % Define a stub for the base font encoding.
  70.  
  71.   /KanjiSubEncoding { /KanjiSubEncoding .findencoding } bind def
  72. %% Replace 3 (gs_ksb_e.ps)
  73.   EncodingDirectory /KanjiSubEncoding
  74.    { (gs_ksb_e.ps) systemdict begin runlibfile KanjiSubEncoding end }
  75.   bind put
  76.  
  77. % Support procedures and data.
  78.  
  79. /T1FontInfo 8 dict begin
  80.   /version (001.001) readonly def
  81.   /FullName (KanjiBase) readonly def
  82.   /FamilyName (KanjiBase) readonly def
  83.   /Weight (Medium) readonly def
  84.   /ItalicAngle 0 def
  85.   /isFixedPitch false def
  86.   /UnderlinePosition 0 def
  87.   /UnderlineThickness 0 def
  88. currentdict end readonly def
  89.  
  90. /T1NF            % <fontname> T1NF <font>
  91. {
  92. 20 dict begin
  93.   /FontName exch def
  94.   /FontType 1 def
  95.   /FontInfo T1FontInfo def
  96.   /FontMatrix [.001 0 0 .001 0 0] def
  97.   /FontBBox [0 0 1000 1000] def
  98.   /Encoding KanjiSubEncoding def
  99.   /CharStrings 150 dict def
  100.   /PaintType 0 def
  101.   /Private 2 dict def
  102.   Private begin
  103.     /BlueValues [] def
  104.     /password 5839 def
  105.   end
  106. FontName currentdict end definefont
  107. } def
  108.  
  109. /T0NF            % <fontname> T0NF <font>
  110. {
  111. 20 dict begin
  112.   /FontName exch def
  113.   /FDepVector exch def
  114.   /FontType 0 def
  115.   /FontMatrix [1 0 0 1 0 0] def
  116.   /FMapType 2 def
  117.   /Encoding KanjiEncoding def
  118. FontName currentdict end definefont
  119. } def
  120.  
  121. % Define the composite font and all the base fonts.
  122.  
  123. /CompNF            % <fontname> CompNF <font>
  124. {
  125. /newname1 exch def
  126. newname1 dup length string cvs /str exch def
  127. str length /len exch def
  128. /fdepvector 78 array def 
  129. /j 1 def
  130. 16#21 1 16#74 {
  131. /i exch def
  132. KanjiEncoding i get 0 gt {
  133. len 4 add string /newstr exch def
  134. newstr 0 str putinterval
  135. newstr len (.r) putinterval
  136. newstr len 2 add  i 16 2 string cvrs putinterval
  137. newstr cvn /newlit exch def
  138. newlit T1NF /newfont exch def
  139. fdepvector j newfont put
  140. /j j 1 add def
  141. } if
  142. } for
  143. fdepvector 0 fdepvector 1 get put
  144. /j 0 def
  145. fdepvector newname1 T0NF
  146. } def
  147.  
  148. % Define an individual character in a composite font.
  149. /CompD            % <charstring> <(HL)> CompD -
  150.  { currentfont /Encoding get 1 index 0 get get    % FDepVector index
  151.    currentfont /FDepVector get exch get        % base font
  152.    dup /Encoding get 3 -1 roll 1 get get    % base font character name
  153.    exch /CharStrings get exch 3 -1 roll put
  154.  } bind def
  155.  
  156. exec
  157.